package stateDiagram.figures;

import static org.jhotdraw.draw.AttributeKeys.TEXT;

import org.jhotdraw.draw.TextFigure;

import stateDiagram.EntityObjects.Event;
import stateDiagram.EntityObjects.StateEntity;

public class ActionTextFigure extends TextFigure {
	private StateEntity entity;
	private Event event;

	
	public ActionTextFigure(String actionName, Event event){
		super();
		this.entity =  entity;
		this.event = event;

	}
	
	public void setText(String newText) {
		String previousContents = getText();
		willChange();
		if(newText != null){
			if (previousContents !=null && ! previousContents.equals(newText)){
				event.setAction(newText);
			}
		
        super.set(TEXT, newText);
        changed();
		}
		else{super.set(TEXT, newText);}
    }
}
